﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cesave.Domain.PermisosModule.Entities;
using Cesave.Domain.Core.Specification;
using Cesave.Domain.PermisosModule.Resources;

namespace Cesave.Domain.PermisosModule.Contracts.Cultivos
{
	/// <summary>
	/// 
	/// </summary>
	public class CultivosByEstacionSpecification
		: Specification<Cultivo>
	{
		#region Private properties

		/// <summary>
		/// 
		/// </summary>
		private Guid _estacionGuid = default(Guid);

		#endregion

		#region Constructor

		/// <summary>
		/// 
		/// </summary>
		public CultivosByEstacionSpecification(Guid estacionGuid)
		{
			if (estacionGuid == Guid.Empty)
				throw new ArgumentException(Messages.exception_InvalidArgument, "estacionGuid");
			_estacionGuid = estacionGuid;
		}

		#endregion

		#region Specification overrides

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		public override System.Linq.Expressions.Expression<Func<Cultivo, bool>> SatisfiedBy()
		{
			Specification<Cultivo> specification = new DirectSpecification<Cultivo>(c => c.EstacionGuid == _estacionGuid);
			return specification.SatisfiedBy();
		}

		#endregion

	}
}
